package com.kuang.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.Map;

//在template下的所有页面只能通过controller跳转
//需要模板引擎支持!thymeleaf
@Controller
public class IndexController {

    @RequestMapping("/t1")
    public String test1(Model model){
        //存入数据
        model.addAttribute("msg","<h2>Hello,Thymeleaf</h2>");
        //classpath:/templates/test.html
        model.addAttribute("users",Arrays.asList("kuangshen","qinjianh"));
        return "test";
    }
}
